import request from '@/utils/request'
export default {
    // 生成注册统计数据
    createStaData(day) {
        return request({
            url: '/staservice/sta/registerCount/'+day,
            method: 'post'
        })
    },
    // 生成订单统计数据
    createOrderData(day) {
        return request({
            url: '/staservice/staorder/orderCount/'+day,
            method: 'post'
        })
    },
    // 获取统计数据
    getDataSta(searchObj) {
        const isOrderStat = ['order_num', 'pay_num', 'unpay_num', 'new_num'].includes(searchObj.type);
        const baseUrl = isOrderStat ? '/staservice/staorder' : '/staservice/sta';
        return request({
            url: `${baseUrl}/showData/${searchObj.type}/${searchObj.begin}/${searchObj.end}`,
            method: 'get'
        })
    }
}